package com.vhly.aapt;

import com.vhly.aapt.io.OrderInputStream;

import java.io.IOException;

/**
 * Created by IntelliJ IDEA.
 * User: vhly[FR]
 * Date: 2010-4-26
 * Time: 16:06:19
 */
public class ResXMLTree_endElementExt extends ResXMLTree_node {
    public int nsStringPoolIndex;
    public int nameStringPoolIndex;

    @Override
    public String toXML() {
        String ret = "";
        StringBuffer sb = new StringBuffer();
        sb.append("</");
        if (nsStringPoolIndex > -1) {
            String nss = pool.entries.get(nsStringPoolIndex);
            int index = nss.lastIndexOf("/");
            if(index != -1){
                nss = nss.substring(index+1);
            }
            sb.append(nss).append(':');
        }
        if (nameStringPoolIndex > -1) {
            sb.append(pool.entries.get(nameStringPoolIndex));
        }
        sb.append('>');
        ret = sb.toString();
        return ret;
    }

    @Override
    public void read(OrderInputStream din) throws IOException {
        super.read(din);
        nsStringPoolIndex = din.readInt();
        nameStringPoolIndex = din.readInt();
    }

    @Override
    public short getHeaderSize() {
        return 0;
    }

    @Override
    public byte[] getData() {
        return new byte[0];
    }
}